package org.demo.test;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.log4j.PropertyConfigurator;
import org.boxlayout.gui.BoxLayoutEngine;
import org.boxlayout.gui.BoxLayoutFrame;
import org.boxlayout.gui.VisualElement;
import org.boxlayout.gui.layout.LayoutFactory;
import org.boxlayout.gui.type.ColorEnum;

public class TextTest2d {
	
	public TextTest2d() {
		final Log log = LogFactory.getLog("main");
    	PropertyConfigurator.configure("log4j.properties");
    	BoxLayoutFrame blf  = new BoxLayoutFrame();
    	BoxLayoutEngine ble = blf.getBoxLayoutEngine();
    	ble.setOrtho(true);
    	ble.getCamera2d().setViewBoundaries(0f, 10f, -10f, 0f);
    	final VisualElement root = ble.createElement()
    	.setLayout(LayoutFactory.getInstance().getVerticalLayout())
    	 	//.setPreferedWidth(2.0f).setPreferedHeight(2.0f)
    	;
    	
    	VisualElement ve = ble.createElement()
    	.setText("1gAbcdef")
    	.setTextSize(1f)
    	.setColor(ColorEnum.GREEN)
    	;
    	
    	VisualElement ve2 = ble.createElement()
    	.setText("2gAbcdef")
    	.setTextSize(0.1f)
    	.setColor(ColorEnum.BLUE)
    	;
    	
    	VisualElement ve3 = ble.createElement()
    	.setText("3gAbcdef")
    	.setTextSize(2f)
    	.setColor(ColorEnum.YELLOW)
    	;
    	
    	
    	ble.setRootElement(root);
    	root.add(ve).add(ve2).add(ve3)
    	;
    	blf.start();
    	ble.reLayout();
    	log.info(root.serializeToText(""));
	}
	
	
	public static void main(String[] args) {
		new TextTest2d();
	}

}
